1. Field of the Invention
The present invention relates to an image processing method, an image processing apparatus and a program storage medium, and particularly to a technology of separating image input such as illustrations and line images into a monospaced line (i.e. a line having a constant line width) and surfaces, and applying vectorization processing suitable for each of them to achieve both high image quality and reusability. Among the separated information, for the monospaced line, center line coordinates are vectorized to add line width information, and for the surfaces, the contour coordinates are vectorized. The vector data is outputted so that the monospaced line is on the top in the display sequence after the region where the monospaced line is located is filled, thus preventing a gap due to vectorization from being generated in the rendered image.
2. Description of the Related Art
In recent years, due to progress in computerization of information, there have been widely spread systems which do not store paper documents as they are, but store the paper documents by converting them into electronic forms by scanners or the like and transmit the electronic data to the other apparatuses. In such systems, high compression of the documents converted into electronic forms is required for the purpose of reducing the transmission cost or the like. Meanwhile, compression of electronic data generally causes degradation of image information, and therefore, reusability that enables the electronized data to be partially edited, and maintenance of high image quality even after enlargement and reduction of the data are required. In order to satisfy the two requirements, various compression methods are proposed, and in some cases compression is incompatible with image quality. For example, when a character region and a photograph region coexist in document data, there arises the problem that if the compression suitable for the character region is performed, the image quality is retained, but the compression rate becomes low, whereas if the compression suitable for the photograph region is performed, the compression rate can be made high, but the image quality of the character region is degraded.
Therefore, there is proposed the method which realizes high compression, reuse and high image quality of a document image by splitting the document data into a character region and a photograph region, and applying processing suitable for each of them (refer to Japanese Patent Laid-Open No. 2009-265389). More specifically, the character region in which primary importance is placed on reusability and high image quality is converted into vector data, and the other region such as a photograph region which cannot be easily reproduced by vectorization is compressed in accordance with JPEG.
Further, there is proposed the method which executes vectorization processing for not only character images but also graphic images (an illustration, and clip art, which are generally called line images) which are characterized by being configured by several uniform colors and having clear contours, as a target of vectorization processing (refer to Japanese Patent Laid-Open No. 2006-344069). In the method proposed here, after the number of colors of the inputted image is reduced by using the similarity of colors, the contour coordinates of each color region are extracted, and functional approximation is performed.
The method for performing the functional approximation for the extracted contour coordinates is disclosed in Japanese Patent Laid-Open No. 2005-310070. In this case, the contour coordinates are divided at the points which satisfy the following conditions:
The first angular point: a point at which the change of the vectors connecting the adjacent point sequences becomes an acute angle
The second angular point: points at both ends in the case of the distance between the consecutive points being larger than a certain threshold value
Inflection point: the point at which the sign of the outer product of the consecutive vectors changes,
and a Bezier curve is applied to the divided sections, whereby the functional approximation is performed.
Japanese Patent Laid-Open No. 2008-196496 discloses the boundary sharing type vectorization method which extracts the common boundary lines among the color regions, performs functional approximation for each of the boundary lines, and outputs the approximation results by connecting them so as to be originally arranged for each color region. Since the approximation result in common between the color regions is used, a gap is not generated in principle.
However, when vectorization is performed, in some cases a gap is generated between the color regions of the image which is obtained by rendering the data obtained as a result of vectorization. This gap is generated when the contour extracted from the color region is individually subjected to functional approximation for each region, and at the time of vectorization of the input by dividing the input into a monospaced line and surfaces. An example of a gap generated in the rendering result for the reason of the latter is shown in FIG. 3. When the inputted image shown in FIG. 3 (a) is divided according to each color, it is divided into three color regions as shown in FIG. 3 (b). FIG. 3 (c) shows the result of dividing each of the color regions into a monospaced line and surfaces. The two color regions at the left are determined as having no monospaced line region. The color region illustrated at the rightmost side is determined as including a monospaced line portion, and is split into the surface and the monospaced line. The images illustrated on the upper stage of FIG. 3 (c) show surfaces, and the image illustrated on the lower stage shows the monospaced line. When the centerline coordinates of the monospaced line and the contour coordinates of the surface shown in FIG. 3 (c) are acquired, subjected to functional approximation and then are outputted as vector data, the result is as shown in FIG. 3 (d). A part of the image obtained by rendering the vector data is displayed as enlarged at the right side of FIG. 3 (d). In the outputted vector data, generation of gaps can be confirmed between the monospaced line and the surface, and between the surfaces.
Generation of the gap can be prevented by vectorizing the boundary lines of the color regions instead of the contours of the color regions, and thereafter connecting the boundary lines. However, with regard to the monospaced line, vector data is frequently desired to be expressed by the information of the center line and the line width of the monospaced line. Accordingly, when the center line coordinates of the monospaced line are vectorized even in a partial region of the input, only the method of vectorizing the boundary line of a color region cannot be applied. The boundary position in the case of rendering a line with a line width normally changes depending on the precision and implementation of the renderer, and an accurate value of the boundary position cannot be obtained in advance. Even if an accurate boundary position is obtained, it is very difficult to perform functional approximation so that a gap is not generated.